#include<iostream>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstdio>
using namespace std;
int n;
vector <bool> map;
queue<int> wt;
void read(){
	cin>>n;
	char x;
	for(int i=1;i<=n*n;i++){
		cin>>x;
		if(x=='*')map.push_back(0);
		else if(x=='.') map.push_back(1);
	}
	
}
void solve(){
	int s=0;
	wt.push(0);
	while(!wt.empty()){
		int x=wt.front();
		wt.pop();
		if(map[x]==1){
			s++;
			map[x]=0;
			if(x==0){
				wt.push(1);
				wt.push(n);
			}
			else if(x>=1&&x<=n-1){
				wt.push(x-1);
				wt.push(x+1);
				wt.push(x+n);
			}
			else if(x%n==0){
				wt.push(x+1);
				wt.push(x-n);
				wt.push(x+n);
			}
			else {
				wt.push(x+1);
				wt.push(x-1);
				wt.push(x+n);
				wt.push(x-n);
			}	
		}
		else continue;
	}
	cout<<s;
	
	
}
int main(){
	freopen("in.txt","r",stdin);
	read();
	solve();
	return 0;
}
